#!/usr/bin/python3
a={0:'0',1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9',10:'A',11:'B',12:'C',13:'D',14:'E',15:'F',16:'G',17:'H',18:'I'}
def SNIDL(num,jz):
    l=[]
    while num != 0:
        nnum=num//jz
        nnm=num%jz
        l.insert(0,a[nnm])
        num=nnum
    y=""
    for i in l:
        y=y+i
    return y
r="y"
while True:
    ed=","
    x=input("Please input a natrual number(fill q or quit to exit):")
    if x == "q" or x =="quit":
        break
    try:
        x=int(x)
        for h in range(2,19):
            if h == 18:
                ed="."
            print(f"In base {h}: {x} in decimal is expressed as {SNIDL(x,h)}{ed}")
        
        r=input("Do you want to do it again?(y/not filled it)")
        if r != "y":
            break
    except:
        print("*Filling error")
        print("Do it again.")
